package com.sxt.generate.table;

import com.sxt.generate.util.SqlUtil;

/**
 *
 * @ClassName: Configuration
 * @Description:Configuration
 * @version:v1.0.0
 * @author: haning
 * @date:
 */
public class Column {
    private String columnName;
    private String fieldName;
    private String defaultValue;
    private String remark;

    private int columnSize;
    private int decimalDigits;
    private int sqlType;

    private boolean isIndexed;
    private boolean isUnique;
    private boolean isNullable;
    private boolean isPrimaryKey;
    private boolean isForeignkey;
    private boolean isAutoIncrement;

    private String javaType;
    private String sqlTypeName;
    private String javaTypeName;


    public void initialize() {
        translateJavaType();
        translateJavaTypeName();
        translatesqlTypeName();
    }

    public void translateJavaType() {
        this.javaType = SqlUtil.convertToJavaType(getSqlType(), getColumnSize());
    }

    public void translateJavaTypeName() {
        this.javaTypeName = SqlUtil.convertToJavaTypeName(getSqlType(), getColumnSize());
    }

    public void translatesqlTypeName() {
        this.sqlTypeName =SqlUtil.convertToSqlType(getSqlType(), getColumnSize());
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public int getDecimalDigits() {
        return decimalDigits;
    }

    public void setDecimalDigits(int decimalDigits) {
        this.decimalDigits = decimalDigits;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public boolean isIndexed() {
        return isIndexed;
    }

    public void setIndexed(boolean isIndexed) {
        this.isIndexed = isIndexed;
    }

    public boolean isUnique() {
        return isUnique;
    }

    public void setUnique(boolean isUnique) {
        this.isUnique = isUnique;
    }

    public boolean isNullable() {
        return isNullable;
    }

    public void setNullable(boolean isNullable) {
        this.isNullable = isNullable;
    }

    public boolean isPrimaryKey() {
        return isPrimaryKey;
    }

    public void setPrimaryKey(boolean isPrimaryKey) {
        this.isPrimaryKey = isPrimaryKey;
    }

    public boolean isForeignkey() {
        return isForeignkey;
    }

    public void setForeignkey(boolean isForeignkey) {
        this.isForeignkey = isForeignkey;
    }

    public boolean isAutoIncrement() {
        return isAutoIncrement;
    }

    public void setAutoIncrement(boolean isAutoIncrement) {
        this.isAutoIncrement = isAutoIncrement;
    }

    public int getColumnSize() {
        return columnSize;
    }

    public void setColumnSize(int columnSize) {
        this.columnSize = columnSize;
    }

    public int getSqlType() {
        return sqlType;
    }

    public void setSqlType(int sqlType) {
        this.sqlType = sqlType;
    }

    public String getJavaType() {
        return javaType;
    }

    public void setJavaType(String javaType) {
        this.javaType = javaType;
    }

    public String getSqlTypeName() {
        return sqlTypeName;
    }

    public void setSqlTypeName(String sqlTypeName) {
        this.sqlTypeName = sqlTypeName;
    }

    public String getJavaTypeName() {
        return javaTypeName;
    }

    public void setJavaTypeName(String javaTypeName) {
        this.javaTypeName = javaTypeName;
    }
}
